package com.foo.designpattern.proxy.staticproxy1;

import junit.framework.TestCase;

/**
 * com.foo.designpattern.proxy.staticproxy1
 * Created with IntelliJ IDEA.
 * Created by jiang on 2016-04-29 17:17.
 *
 * @Description 测试类：静态代理
 * 静态代理：由程序员创建或特定工具自动生成源代码，再对其编译。在程序运行前，代理类的.class文件就已经存在了。
 */

public class StaticProxy1TestCase extends TestCase {
    public void testStaticProxy1() {
        System.out.println("= = = = ↓↓↓代理模式：静态代理，测试开始↓↓↓ = = = =");

        // 初始化真实对象
        RealSubject realSubject = new RealSubject();
        // 初始化代理对象
        Subject subject = new ProxySubject(realSubject);
        // 代理对象执行时内部的小动作也执行了
        subject.request();

        System.out.println("= = = = ↑↑↑代理模式：静态代理，测试结束↑↑↑ = = = =");
    }
}
